<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>函数计算圆的面积和周长</title>
</head>

<body>
    <script>
        function getArea(r) {
            r = r || 0;
            var p = 3.1415926;
            return p * r * r;
        }
        var r = parseInt(prompt("请输入半径"));
        var area = getArea(r);
        console.log("半径为" + r + "的圆的面积是：" + area);

        function getLong(r) {
            r = r || 0;
            return 2 * Math.PI * r;
        }
        var long = getLong(r);
        console.log("半径为" + r + "的圆的周长是:" + long);
    </script>
</body>

</html>